﻿<?php

include_once "../conf/conf.inc";
include_once "../util/util.php";
include_once "../util/DBHelper.php";

$tmpCuttentDateTime = GetCurrentDateTime();
$tmpCount = 20;

function initDB_total_everyday($tmpCuttentDateTime, $count)
{ 	
	$datetime_begin = $tmpCuttentDateTime;
	//$count = 10;

	//--获取日期成数组
	$tmpDatetimeArray = GetDataArrayFromBeginToCount($datetime_begin, $count);
 
	$msg = "";
	$returnArray = array(); 
	
	//---根据日期数组查询相应的信息
	foreach($tmpDatetimeArray as $tmpVal)
	{
		$str_sql = "insert into t_log_total_everyday(s_time, gold_sys_provide, gold_use) values(date_format('$tmpVal', '%Y-%m-%d'), 0, 0);";
		if(DBHelper::Exec($str_sql) >0)
			echo("[$tmpVal] insert success <br/>");
		else
			echo("[$tmpVal] insert error: day have exist********************** <br/>");
	}
}

//---
if(isset($_REQUEST["datetime_begin"]) && isset($_REQUEST["count"]))
{	
	$tmpCuttentDateTime = $_REQUEST["datetime_begin"];
	$tmpCount = $_REQUEST["count"];
	initDB_total_everyday($tmpCuttentDateTime, $tmpCount);
} 

?>


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title></title>
    <link type="text/css" href="../html/cs/default.css" rel="stylesheet"></link>
  </head>
  <body>
	 <form method="post" enctype="multipart/form-data" id="form">
	<table cellpadding="0" cellspacing="0">
		<tr>
			<td colspan="2" class="tr_distance">表t_log_total_everyday插入日期</td>
		</tr>
		
        <tr>
          <td style="width:100px">
            <span>开始日期</span>
          </td>
          <td> 
			<input type="text" name="datetime_begin" id="datetime_begin" class="input" value="<?php echo $tmpCuttentDateTime?>"/>
          </td> 
        </tr> 
        <tr>
          <td>
            <span>数量(天)</span>
          </td>
          <td> 
			<input type="text" name="count" id="count" class="input" value="<?php echo $tmpCount?>"/>
          </td> 
        </tr> 
        <tr>
          <td colspan="2">
            <input type="submit" style="width: 80px;" value="提交" />
          </td>
        </tr>
	</table>  
	  
	</form>
  </body>
</html>